package com.itheima.mapper;

import com.itheima.pojo.DishFlavor;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author wuyiqiang
 * @2022/6/15 10:24
 */
@Mapper
public interface DishFlavorMapper {

    /**
     * 口味添加
     * @param dishFlavors
     */
    void batchsave(@Param("flavorList")List<DishFlavor> dishFlavors);

    /**
     * 删除口味
     * @param id
     */
    @Delete("delete from dish_flavors where dish_id=#{dishId}")
   void deleteByDishId(String id);

    /**
     * 根据菜品id查询口味
     * @param dishId
     * @return
     */
    @Select("select * from dish_flavors where dish_id=#{dishId} ;")
    List<DishFlavor> selectByDishId(String dishId);
}
